import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../common.dart';

class Parties extends StatefulWidget {
  Parties({super.key});
  @override
  State<Parties> createState() => _QGRulePageState();
}

class _QGRulePageState extends State<Parties> {
  List<String> items = ['我的藏品', '热门回收', '最高价'];
  int tindex = 0;
  List dlist = [
    {"img": "aaa", "name": "名字", "price": "1213"},
    {"img": "aaa", "name": "名字", "price": "1213"},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0XFFFFFFFF),
        centerTitle: true,
        leading: buildBackButton(context),
      ),
      body: Padding(
        padding: EdgeInsets.symmetric(horizontal: 15),
        child: Column(
          children: [
            Row(
              children: [
                wImage(url: 'aaa', width: 32, height: 32, borderRadius: 32),
                SizedBox(width: 5),
                wText(text: '用户名最多最多十个字', bold: true, size: 14),
                Expanded(child: SizedBox()),
                GestureDetector(
                  onTap: () {
                    toNamed('/home/exchange/listdate');
                  },
                  child: wImage(url: 'sankai', width: 30),
                ),
              ],
            ),
            SizedBox(height: 25),
            Row(
              children: List.generate(items.length, (index) {
                return Container(
                  margin: EdgeInsets.only(right: 25),
                  child: wText(
                    text: items[index],
                    color: tindex == index ? '0F172B' : '878b95',
                    size: 14,
                    bold: true,
                  ),
                );
              }),
            ),
            SizedBox(height: 15),
            Row(
              children: [
                wText(text: '数字藏品', color: '878b95'),
                Expanded(child: SizedBox()),
                Container(
                  width: 80,
                  child: wText(text: '当前市值(ST)', color: '878b95'),
                ),
                SizedBox(width: 15),
                Container(
                  width: 65,
                  child: wText(text: '回收价(ST)', color: '878b95'),
                ),
              ],
            ),
            SizedBox(height: 5),
            Expanded(
              child: ListView.builder(
                itemCount: dlist.length, // 子项的总数
                itemBuilder: (context, index) {
                  // 根据索引返回相应的Widget
                  return GestureDetector(
                    onTap: () {
                      toNamed('/home/exchange/exchange_details');
                    },
                    child: Container(
                      padding: EdgeInsets.only(bottom: 20),
                      margin: EdgeInsets.only(bottom: 20),
                      decoration: BoxDecoration(
                        border: Border(
                          bottom: BorderSide(color: Color(0XFFDDDDDD)),
                        ),
                      ),
                      child: Row(
                        children: [
                          wImage(
                            url: 'aaa',
                            width: 32,
                            height: 32,
                            borderRadius: 5,
                          ),
                          Container(
                            margin: EdgeInsets.only(left: 5),
                            width: 120,
                            child: wText(text: '藏品名称二十个字藏品名称二十'),
                          ),

                          Expanded(child: SizedBox()),
                          Container(
                            width: 80,
                            child: wText(
                              text: '23549.21',
                              color: '878b95',
                              bold: true,
                            ),
                          ),
                          SizedBox(width: 15),
                          Container(
                            width: 65,
                            child: wText(
                              text: '23549.21',
                              color: 'B10000',
                              bold: true,
                            ),
                          ),
                        ],
                      ),
                    ),
                  );
                },
              ),
            ),
          ],
        ),
      ),
    );
  }
}
